package com.pactera.asmp.server.service;

import com.pactera.asmp.server.entity.ProjectDetailVo;
import com.pactera.asmp.server.entity.ProjectInfoSearchDTO;
import com.pactera.asmp.server.entity.ProjectModuleBindDto;
import com.pactera.asmp.server.entity.ProjectModuleDTO2;
import com.pactera.asmp.server.entity.ProjectProductionConfig;
import com.pactera.asmp.server.pojo.ProjectInfo;
import com.pactera.asmp.server.pojo.ProjectVersionInfo;
import com.pactera.asmp.server.pojo.UserProject;
import com.pactera.asmp.server.utils.PageDataResult;

import org.springframework.web.multipart.MultipartFile;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @ProjectName: asmpserver
 * @Package: com.pactera.asmp.server.service
 * @ClassName: ProjectManagerService
 * @Author: lvzhiqiang
 * @Description: Project业务操作类
 * @Date: 2019/8/2 11:52
 * @Version: 1.0
 */
public interface ProjectManagerService {

    /**
     * @Method getIssues
     * @Description getIssues
     * @param: [issueSearchDTO,page, limit]
     * @return: PageDataResult
     * @auther: lzq
     * @date: 2019/8/2 13:51
     */
    PageDataResult getProjectList(ProjectInfoSearchDTO projectInfoSearchDTO, int page, int limit);

    /**
     * @Method delProjects
     * @Description delProjects
     * @param: [ids]
     * @return: String
     * @auther: lzq
     * @date: 2019/8/2 13:54
     */
    String delProjects(List<Integer> datas);

    /**
     * @Method delProject
     * @Description delProject
     * @param: [id]
     * @return: String
     * @auther: lzq
     * @date: 2019/8/2 13:54
     */
    String delProject(Integer id);

    /**
     * @Method updateProjectInfo
     * @Description updateProjectInfo
     * @param: projectInfo
     * @auther: lzq
     * @date: 2019/8/9 17:45
     */
    String updateProjectInfo(ProjectInfo projectInfo);

    /**
     * @Method getProjectListByUserId
     * @Description getProjectListByUserId
     * @param: id
     * @return: List<ProjectInfo>
     * @auther: lzq
     * @date: 2019/8/9 18:02
     */
    List<ProjectInfo> getProjectListByUserId(Integer id);

    /**
     * 查找所有项目名称
     * @return
     */
    List<ProjectInfo> getProjectName();

    /**
     * 查找某项目最近5个版本
     * @return
     */
    List<ProjectVersionInfo> getRecentVersion(String projectName);

    List<ProjectVersionInfo> getAllVersion(String projectName);

    String getRecentProjectNameByUserEmail(String email);

    ProjectInfo selectByName(String name);

    /**
     * 新增项目及绑定属性
     * @param dbcFiles
     * @param userProjects
     * @param deviceIds
     * @param projectModuleDTOs
     * @param request
     * @return
     */
    int add(MultipartFile[] dbcFiles, List<UserProject> userProjects, Integer[] deviceIds, Integer[] masterComputerIds,
            List<ProjectModuleDTO2> projectModuleDTOs, HttpServletRequest request);

    /**
     * 获取项目详情及绑定的模块和用户
     * @param projectId
     * @return
     */
    ProjectDetailVo detail(Integer projectId);

    /**
     * 更新项目及其绑定的模块、用户、dbc
     * @param dbcFiles
     * @param dbcDeleteIds
     * @param userProjects
     * @param projectModuleDTOs
     * @param request
     * @return
     */
    int update(MultipartFile[] dbcFiles, Long[] dbcDeleteIds, List<UserProject> userProjects,
            List<ProjectModuleDTO2> projectModuleDTOs, HttpServletRequest request);

    /**
     * 更新项目模块
     * @param projectModuleBindDto
     * @return
     */
    int updateProjectModule(ProjectModuleBindDto projectModuleBindDto);

    List<ProjectInfo> getProjectUnbindByDeviceId(Integer deviceId);

    /**
     * 删除项目关联用户
     * 
     * @param userIds
     * @param projectId
     * @return
     */
    int delProjectUser(Integer[] userIds, Integer projectId);

    /**
     * 导出项目
     * 
     * @param projectInfoSearchDTO
     * @param response
     */
    void export(ProjectInfoSearchDTO projectInfoSearchDTO, HttpServletResponse response);

    ProjectProductionConfig getProductionConfig(Integer projectId);
}
